package com.uuuo.retrofit2.Converter;

/**
 * Created by JiaTao on 2018/5/16.
 * Email: 535318720@qq.com
 * Version: 1.0
 * Description:
 */
public class ApiException extends RuntimeException {
    private int mErrorCode;

    public ApiException(int errorCode, String errorMessage) {
        super(errorMessage);
        mErrorCode = errorCode;
    }

    /**
     * 获取错误返回值
     * @return
     */
    public int getmErrorCode() {
        return mErrorCode;
    }

    /**
     * 判断是否是token失效
     *
     * @return 失效返回true, 否则返回false;
     */
    public boolean isTokenExpried() {
        return mErrorCode == HttpBaseResult.TOKEN_EXPRIED;
    }
}